<template>
  <div>
    <el-tabs type="card">

      <el-tab-pane lazy>
        <span slot="label"> 未发货礼品订单</span>
        <order-table :order-type="0" :status="0"
                     need-ctrl
                     ref="noPostOrder"
        >
          <template slot="ctrl" slot-scope="scope">
            <el-button type="success"
                       plain
                       size="small"

                       @click="handlePost(scope.info,$refs['noPostOrder'])"
            >立即发货
            </el-button>
          </template>
        </order-table>

      </el-tab-pane>
      <el-tab-pane lazy>
        <span slot="label"> 已发货礼品订单</span>
        <order-table :order-type="0" :status="1"></order-table>

      </el-tab-pane>
      <el-tab-pane lazy>
        <span slot="label"> 所有礼品订单</span>
        <order-table :order-type="0"/>

      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>


import OrderTable from "@/views/commodityManage/components/orderTable";

export default {
  components: { OrderTable },

  methods: {
    async handlePost (info, noPostOrder) {
      const redeemId = info.redeemId;
      const res = await this.$http.ConfirmGiftPost({ redeemId });
      if (res.code !== 0) return null;
      // this.$router.go(0);
      await noPostOrder.handleGetOrderByType();
    },
  },

};
</script>
